The present invention relates to dividing a transaction into processes based on optimistic locking and pessimistic locking, and to executing the processes in a distributed environment during on-line transaction processing.
In recent years, on-line transaction processing (OLTP) systems, which employ a form of directly accepting processing from a large number of users, have been increasing as the systems have become web based. For this reason, the demand for better processing performance and scalability of the systems has been increasing. In order to make such systems scalable, generally, a multilayer architecture constituted of multiple application servers and multiple database management systems (hereinafter, referred to as a DBMS) is employed. It is preferable that processing in the application servers be designed so as to support scale-out in general. However, unless the processing for a database access and the processing relating to a DBMS are carefully designed, a bottleneck in the database access is generated, so that the application servers cannot be scaled out.
A concurrency control mechanism used in a large number of OLTP systems, today, is a mechanism termed as a pessimistic concurrency control (hereinafter, simply referred to as pessimistic CC) mechanism. Under pessimistic CC, a lock acquisition process is performed in a DBMS upon access of data. Such a method allows conflicts of reading and writing between transactions to be securely controlled. However, since a lock acquisition process needs to be performed via communications, network delays may occur. For this reason, the pessimistic CC has a problem of poor scalability. In addition, the load is concentrated on the DBMS.
On the other hand, as an effective technique for solving the problem of the poor scalability of pessimistic CC, there is an optimistic concurrency control (hereinafter, simply referred to as optimistic CC) mechanism. Based on the assumption that conflicts of locks barely occur, under optimistic CC, transaction processing is continuously performed without acquiring locks, and conflicts of reading and writing are checked (validated) collectively at the time of committing a transaction to a DB. The transaction is committed to the DB only in a case where there is no conflict of reading and writing. In a case where there are conflicts of reading and writing, re-execution of the transaction is attempted. Optimistic CC is a processing method with excellent scalability since a lock acquisition request is not issued to the DBMS during the middle of the transaction processing under optimistic CC. However, when there are data accesses (hot spots) where conflicts of reading and writing frequently occur re-executions of the transaction occur so many times that the processing performance of the system is deteriorated.
There are proposed some techniques with excellent scalability for executing transactions by suppressing the cost of locks to the minimum by applying pessimistic CC only to a resource where conflicts of reading and writing likely occur, while applying optimistic CC to other resources. However, in a case where such techniques are utilized, there are also cases where conflicts of locks with respect to the resources frequently occur in a distributed environment due to the influence of the execution of the transaction from the acquisition of a lock till the releasing of the lock, and of network delays.
Furthermore, U.S. Patent Application Publication No. 20020174162 proposes a technique, in which operations of writing to resources in conflict are delayed until immediately before committing a transaction to the resources, and then determinations for writing are made in a concentrated manner at the time of committing the transaction thereto. By use of this technique, it is made possible to perform a process of assigning a sequence number to each of multiple transactions without conflicts in order to commit the multiple transactions to a transactional object. However, it is difficult to apply this technique to processes other than the number assignment process.
The technique disclosed in U.S. Patent Application Publication No. 20060136454 is merely to divide nodes into those processing the transactions by using pessimistic locking, and those process using optimistic locking, and is not to divide transaction contexts. Furthermore, the technique disclosed in U.S. Pat. No. 7,111,290 relates to a computer including a function to execute a program written in command sets different (sub-command sets) from original command sets (main command sets) of the computer, by hardware emulation. The execution of sub-command sets takes longer time than the execution of main command sets due to the overhead related to the emulation. Accordingly, it is desirable for a program written in the sub-command sets to be converted into one written in the main command sets to achieve faster execution. However, the process of conversion itself also takes time. Accordingly, there is a tradeoff relationship within these costs. Moreover, the technique disclosed in U.S. Pat. No. 7,111,290 detects a part having influence on the execution speed by profiling the execution of a program written in sub-command sets, and then converts only the detected part into main command sets. Thereby, the execution becomes faster while the conversion costs are suppressed. As such, the technique disclosed in U.S. Pat. No. 7,111,290 does not necessarily relate to the function to execute transactions in a distributed environment.